/**
 * 2015，thor.com，all rights reserved。
 * 
 * Project：		thor-common
 * Filename：	QueryResultConverter.java
 * Created：		2015年3月14日
 * Creator：		thor
 */
package com.thor.palmmall.spi.order;

import org.springframework.core.convert.converter.Converter;

import com.thor.commons.entity.BeanOperateInfo;
import com.thor.commons.util.StringUtil;
import com.thor.palmmall.spi.common.SOperateInfo;
import com.thor.palmmall.spi.common.SOperatorConverter;

/**
 * @author thor
 *
 */
public class SOrderOperateInfoConverter implements Converter<BeanOperateInfo, SOperateInfo> {

	public static SOrderOperateInfoConverter getInstance() {
		if (instance == null)
			instance = new SOrderOperateInfoConverter();
		return instance;
	}

	private static SOrderOperateInfoConverter instance;

	private SOrderOperateInfoConverter() {
	}

	@Override
	public SOperateInfo convert(BeanOperateInfo source) {
		if (source == null)
			return null;

		SOperateInfo target = new SOperateInfo();
		target.setOperator(SOperatorConverter.getInstance().convert(source.getOperator()));
		target.setTime(StringUtil.dateToString(source.getTime(), "yyyy-MM-dd HH:mm:ss"));

		return target;
	}
}
